package com.rainwood.water_authority.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.rainwood.water_authority.R;
import com.rainwood.water_authority.base.MyBaseAdapter;
import com.rainwood.water_authority.model.IssueNoticeBean;

/**
 * @author sxs
 * @date :2020/9/28
 * @desc: 物资出库
 */
public final class IssueOutboundBaseAdapter extends MyBaseAdapter<IssueNoticeBean> {

    public IssueOutboundBaseAdapter(@NonNull Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private class ViewHolder extends MyBaseAdapter.ViewHolder{

        private final TextView mIssueNameView;
        private final TextView mApplyNumView;
        private final TextView mOutboundNumView;
        private final TextView mMaterialNoView;
        private final TextView mModelView;
        private final TextView mUnitView;

        public ViewHolder() {
            super(R.layout.item_issue_outbound_sigle);
            mIssueNameView = (TextView) findViewById(R.id.tv_issue_name);
            mApplyNumView = (TextView) findViewById(R.id.tv_apply_num);
            mOutboundNumView = (TextView) findViewById(R.id.tv_outbound_num);
            mMaterialNoView = (TextView) findViewById(R.id.tv_material_number);
            mModelView = (TextView) findViewById(R.id.tv_model);
            mUnitView = (TextView) findViewById(R.id.tv_measuring_unit);
        }

        @Override
        public void onBindView(int position) {
            mIssueNameView.setText(getItem(position).getIssueName());
            mApplyNumView.setText(String.valueOf(getItem(position).getApplyNum()));
            mOutboundNumView.setText(String.valueOf(getItem(position).getOutboundNum()));
            mMaterialNoView.setText(getItem(position).getIssueNo());
            mModelView.setText(getItem(position).getModel());
            mUnitView.setText(getItem(position).getUnit());
        }
    }
}
